//
//  ZYCStuAttendanceStatistDetailCell.m
//  ZDSC
//
//  Created by ZDTX on 2021/7/27.
//

#import "ZYCStuAttendanceStatistDetailCell.h"
#import "ZYCAttendanceStatisticsModel.h"

@interface ZYCStuAttendanceStatistDetailCell ()

@property (nonatomic, strong) UILabel *gradeLabel;
@property (nonatomic, strong) UILabel *line;
@property (nonatomic, strong) UILabel *normalLabel;
@property (nonatomic, strong) UILabel *lateLabel;
@property (nonatomic, strong) UILabel *leaveLabel;
@property (nonatomic, strong) UILabel *absentlLabel;

@end

@implementation ZYCStuAttendanceStatistDetailCell

- (void)setModel:(ZYCAttendanceStatisticsModel *)model{
    _model = model;
    _gradeLabel.text = model.className;
    _normalLabel.text = [NSString stringWithFormat:@"正常/%@",model.countZC];
    _lateLabel.text = [NSString stringWithFormat:@"迟到/%@",model.countCD];
    _leaveLabel.text = [NSString stringWithFormat:@"请假/%@",model.countQJ];
    _absentlLabel.text = [NSString stringWithFormat:@"未到/%@",model.countWD];
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self.contentView addSubview:self.gradeLabel];
        [self.contentView addSubview:self.line];
        [self.contentView addSubview:self.normalLabel];
        [self.contentView addSubview:self.lateLabel];
        [self.contentView addSubview:self.leaveLabel];
        [self.contentView addSubview:self.absentlLabel];
        
        [self.gradeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(19.0f);
            make.top.equalTo(self.contentView).offset(20.0f);
        }];
        
        [self.line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(20.0f);
            make.right.equalTo(self.contentView).offset(-20.0f);
            make.top.equalTo(self.gradeLabel.mas_bottom).offset(17.0f);
            make.height.mas_equalTo(1);
        }];
        
        
        [self.normalLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(19.0f);
            make.top.equalTo(self.line.mas_bottom).offset(17.0f);
        }];

        [self.lateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.contentView.mas_centerX).offset(-30.0f);
            make.top.equalTo(self.line.mas_bottom).offset(17.0f);
        }];

        [self.leaveLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_centerX).offset(30.0f);
            make.top.equalTo(self.line.mas_bottom).offset(17.0f);
        }];

        [self.absentlLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.contentView).offset(-19.0f);
            make.top.equalTo(self.line.mas_bottom).offset(17.0f);
        }];
        
    }
    return self;
}

- (UILabel *)normalLabel {
    if (!_normalLabel) {
        _normalLabel = [UILabel LabelWithFont:kCustomFont(@"PingFangSC-Regular", 14.0f) titleColor:HEX_RGB(@"39A85B") textAlignment:ZZTextAlignmentLeft];
    }
    return _normalLabel;
}

- (UILabel *)lateLabel {
    if (!_lateLabel) {
        _lateLabel = [UILabel LabelWithFont:kCustomFont(@"PingFangSC-Regular", 14.0f) titleColor:HEX_RGB(@"#E93C06") textAlignment:ZZTextAlignmentLeft];
    }
    return _lateLabel;
}

- (UILabel *)leaveLabel {
    if (!_leaveLabel) {
        _leaveLabel = [UILabel LabelWithFont:kCustomFont(@"PingFangSC-Regular", 14.0f) titleColor:HEX_RGB(@"#FDA252") textAlignment:ZZTextAlignmentLeft];
    }
    return _leaveLabel;
}


- (UILabel *)absentlLabel {
    if (!_absentlLabel) {
        _absentlLabel = [UILabel LabelWithFont:kCustomFont(@"PingFangSC-Regular", 14.0f) titleColor:HEX_RGB(@"#262A28") textAlignment:ZZTextAlignmentLeft];
    }
    return _absentlLabel;
}

- (UILabel *)gradeLabel {
    if (!_gradeLabel) {
        _gradeLabel = [UILabel LabelWithFont:kCustomFont(@"PingFangSC-Regular", 17.0f) titleColor:HEX_RGB(@"#262A28") textAlignment:ZZTextAlignmentLeft];
    }
    return _gradeLabel;
}

- (UILabel *)line {
    if (!_line) {
        _line = [[UILabel alloc] init];
        _line.backgroundColor = HEX_RGB(@"#EAEAEA");
    }
    return _line;
}
@end
